stubs = map(lambda x: "fslayer/fslayer_" + x + "_stub.c",
      Split('''open close read write lseek lstat stat fstat unlink rename chmod
      	       link symlink _getdir access utime mkdir rmdir realBasename'''))

Command(stubs + ['fslayer/fslayer.h'],
	'fslayer/gen_fslayer.pl',
	"perl gen_fslayer.pl",
	chdir=1)

libc = Library("libc", stubs + Split('''
	hash/hash.c
	hash/hash_tofile.c
	hash/hash_tostr.c
	hash/memhash.c
	hash/wrapmdbm.c
	mdbm/byte_order.c
	mdbm/debug.c
	mdbm/hash.c
	mdbm/mdbm.c
	mdbm/mtst.c
	regex/re_fail.c
	regex/regex.c
	stdio/_ftello.c
	stdio/asprintf.c
	stdio/fclose.c
	stdio/fdopen.c
	stdio/fflush.c
	stdio/fgetc.c
	stdio/fgetline.c
	stdio/fgetln.c
	stdio/fgetpos.c
	stdio/fgets.c
	stdio/fgetstr.c
	stdio/fileprintf.c
	stdio/findfp.c
	stdio/flags.c
	stdio/fopen.c
	stdio/fparseln.c
	stdio/fprintf.c
	stdio/fpurge.c
	stdio/fputc.c
	stdio/fputs.c
	stdio/fread.c
	stdio/freopen.c
	stdio/fscanf.c
	stdio/fseek.c
	stdio/fseeko.c
	stdio/fsetpos.c
	stdio/ftell.c
	stdio/ftello.c
	stdio/funopen.c
	stdio/fvwrite.c
	stdio/fwalk.c
	stdio/fwrite.c
	stdio/gettemp.c
	stdio/makebuf.c
	stdio/mkdtemp.c
	stdio/mkstemp.c
	stdio/printf.c
	stdio/puts.c
	stdio/refill.c
	stdio/remove.c
	stdio/rewind.c
	stdio/rget.c
	stdio/scanf.c
	stdio/setbuf.c
	stdio/setbuffer.c
	stdio/setvbuf.c
	stdio/snprintf.c
	stdio/sprintf.c
	stdio/sscanf.c
	stdio/stdio.c
	stdio/ungetc.c
	stdio/vasprintf.c
	stdio/vfprintf.c
	stdio/vfscanf.c
	stdio/vprintf.c
	stdio/vscanf.c
	stdio/vsnprintf.c
	stdio/vsprintf.c
	stdio/vsscanf.c
	stdio/wbuf.c
	stdio/wsetup.c
	string/bcopy.c
	string/bzero.c
	string/ffs.c
	string/index.c
	string/memccpy.c
	string/memchr.c
	string/memcmp.c
	string/memcpy.c
	string/memmem.c
	string/memmove.c
	string/memset.c
	string/rindex.c
	string/strcasecmp.c
	string/strcasestr.c
	string/strcat.c
	string/strchr.c
	string/strcmp.c
	string/strcnt.c
	string/strcpy.c
	string/strcspn.c
	string/strdup.c
	string/strlen.c
	string/strncat.c
	string/strncmp.c
	string/strncpy.c
	string/strndup.c
	string/strpbrk.c
	string/strrchr.c
	string/strsep.c
	string/strspn.c
	string/strstr.c
	string/strtok.c
	string/trim.c
	tcp/tcp.c
	utils/cleanpath.c
	utils/concat_path.c
	utils/dirname.c
	utils/dirs.c
	utils/efopen.c
	utils/fileinfo.c
	utils/fileops.c
	utils/fileutils.c
	utils/findpid.c
	utils/fmem.c
	utils/fullname.c
	utils/getnull.c
	utils/getopt.c
	utils/glob.c
	utils/lines.c
	utils/lines_tests.c
	utils/milli.c
	utils/mkdir.c
	utils/mmap.c
	utils/putenv.c
	utils/realbasename.c
	utils/rlimit.c
	utils/rmrepo.c
	utils/rmtree.c
	utils/samepath.c
	utils/sig.c
	utils/smartrename.c
	utils/spawn.c
	utils/spawn_filterpipeline.c
	utils/spawnvpio.c
	utils/str_subst.c
	utils/sys.c
	utils/system.c
	utils/testcode.c
	utils/trace.c
	utils/tty.c
	utils/ttyprintf.c
	utils/utils.c
	utils/webencode.c
	utils/which.c
	utils/zgets.c
	zlib/adler32.c
	zlib/compress.c
	zlib/crc32.c
	zlib/deflate.c
	zlib/gzio.c
	zlib/infblock.c
	zlib/infcodes.c
	zlib/inffast.c
	zlib/inflate.c
	zlib/inftrees.c
	zlib/infutil.c
	zlib/trees.c
	zlib/uncompr.c
	zlib/zutil.c
'''),
	CPPPATH=".")

Program('mtst', ['mdbm/mtst.o', libc])

Return("libc");
